StrikeOut Text

I'm trying to figure out how to add strike-out format to an entire Object Text, preserving other rich-text markup and OLE diagrams. This did not work:

buf  = "{\\rtf1 \\strike "
buf += richTextWithOle(obj, "Object Text")
buf += "\\strike0 }"
obj."Object Text" = richText(buf)


I'm thinking I'll end up having to plow through all the RichTextParagraphs and then all the RichText chunks in the text, get the properties and OLE, and completely re-construct the new text using clever markup commands. Yuuuuuck.

Thoughts?

 

 

  • Louie

 

 


llandale - Wed Aug 11 08:44:46 EDT 2010

Re: StrikeOut Text
Mathias Mamsch - Wed Aug 11 09:04:52 EDT 2010

You can use "richTextFragment" to remove the header from the rtf before doing the "strike":
 

string s = richTextFragment richTextWithOle (object 171)."Object Text"
(object 186)."Object Text" = richText ("{\\rtf1 \\strike " s "}")

 


Regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: StrikeOut Text
Zetareticuli - Wed Aug 11 10:03:49 EDT 2010

Strikeout as an RTF does not need to be part of the RTF header. It can immediately precede the text which requires strikethrough. I've done something similar to this (but with highlighting) by extracting a string value of the RTF object text and locating the index of where the object text actually starts. Rather than using richTextFragment, I had done this by looking for the first space after the "viewkind" tag. I then spliced in the strikethrough RTF tag:
\\strike
To terminate the strikethrough, I iterated through the string in reverse and looked for the last paragraph mark (i.e. \\par) and spliced in the strikethrough terminator:
\\strike0

That worked for me.

Re: StrikeOut Text
llandale - Wed Aug 11 15:33:05 EDT 2010

Mathias Mamsch - Wed Aug 11 09:04:52 EDT 2010

You can use "richTextFragment" to remove the header from the rtf before doing the "strike":
 

string s = richTextFragment richTextWithOle (object 171)."Object Text"
(object 186)."Object Text" = richText ("{\\rtf1 \\strike " s "}")

 


Regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Golly, when I played with richTextFragment it removed my OLE.

Thanks. - Louie

Re: StrikeOut Text
Mathias Mamsch - Wed Aug 11 18:00:45 EDT 2010

llandale - Wed Aug 11 15:33:05 EDT 2010
Golly, when I played with richTextFragment it removed my OLE.

Thanks. - Louie

It removed mine too... until I added a print statement and saw that the OLE was still in there, so I figured it will need the \\rtf1 at the beginning or it will not show the OLE (but weird: it will show the RTF text with formatting). Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS